/*
 * @Author: wangqizhang
 * @Date: 2024-04-20 20:58:14
 * @LastEditors: wangqizhang
 * @LastEditTime: 2024-05-07 09:07:44
 * @FilePath: /suixinji-react/vite.config.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  server: {
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:5200/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    },
  },
  resolve: {
    alias: {
      '-': '/src',
    },
  },
  build: {
    // rollupOptions: {
    //   output: {
    //     // 配置输出文件的基本路径
    //     dir: 'dist/pkg',
    //     // 配置输出的包的格式
    //     entryFileNames: '[name].js',
    //     // 配置 chunk 的名称
    //     assetFileNames: '[name].[ext]',
    //   },
    // },
    terserOptions: {
      compress: {
        drop_console: true,
        drop_debugger: true,
      },
    },
    sourcemap: false,
  },
  // define: {
  //   'process.env.PRODUCTION_URL': 'http://140.143.140.185:5200/',
  //   'process.env.DEVELOPMENT_URL': '"/api"',
  // },
});
